import request from '@/utils/request.ts'
import {IPatientParams,IAddPatientParams, IUpdatePatientParams,ISendDataParams } from '@/types/patient'
enum API {
    GETHPSPITALLIST_URL = '/api/v1/hospital/list',//获取医院下拉列表
    GETPATIENTLIST_URL = '/api/v1/patient/searchPage',//获取患者分页列表
    ADDPATIENT_URL = '/api/v1/patient/add',//新增患者
    GETPATIENTMESSAGE_URL = '/api/v1/patient/detail',//获取患者信息
    UPDATEPATIENTMESSAGE_URL = '/api/v1/patient/update',//编辑患者信息
    ADDTEST_URL = '/api/v1/mci/addtest',//开始测评
    SEND_DATA = '/api/v1/patient/trial-start' //开始测评
    
}
//获取医院下拉列表
export function getHospitalList() {
    return request({
        url: API.GETHPSPITALLIST_URL,
        method: 'get',
    })
}
//获取患者分页列表
export function getPatientList(data: IPatientParams) {
    return request({
        url: API.GETPATIENTLIST_URL,
        method: 'post',
        data
    })
}
//新增患者
export function addPatient(data: IAddPatientParams) {
    return request({
        url: API.ADDPATIENT_URL,
        method: 'post',
        data
    })
}
//获取患者信息
export function getPatientMessage(patientId: string) {
    return request({
        url: API.GETPATIENTMESSAGE_URL + '?' + `patientId=${patientId}`,
        method: 'get',
    })
}
//编辑患者信息
export function updatePatientMessage(data: IUpdatePatientParams) {
    return request({
        url: API.UPDATEPATIENTMESSAGE_URL,
        method: 'post',
        data
    })
}
//开始测评
export function addTest(patientId: string) {
    return request({
        url: API.ADDTEST_URL + '?' + `patientId=${patientId}`,
        method: 'get',
    })
}
export function sendData(data:ISendDataParams){
    return request({
        url:API.SEND_DATA,
        method:'post',
        data
    })
}
